package com.eastelsoft.smartiot.bssserver.controller;

import com.eastelsoft.smartiot.bssserver.model.Register;
import com.github.pagehelper.util.StringUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import  com.eastelsoft.smartiot.bssserver.model.RespBean;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.Map;

/**
 * 用户注册消息处理类
 * Created by sang on 2018/1/27.
 */
//@RestController
//@RequestMapping("/manageuser")
//public class ManageUserController {
//    protected Logger logger = LoggerFactory.getLogger(getClass());
//    @SuppressWarnings("SpringJavaInjectionPointsAutowiringInspection")
//    @Autowired
//    ManageUserService manageUserService;
//    @Autowired
//    private HttpServletRequest request;
//    @RequestMapping(value = "/register", method = RequestMethod.POST)
//    public RespBean userRegister(@RequestParam String companyName,@RequestParam String industryInfo,
//                                 @RequestParam String mobilePhone,@RequestParam String password,
//                                 @RequestParam String contactPersion,@RequestParam String contactPersionMobile,
//                                 @RequestParam String verificationCode) {
//
//        logger.info("companyName:"+ companyName+"industryInfo:"+industryInfo+"mobilePhone:"
//                +mobilePhone+"password:"+password+"contactPersion:"+contactPersion+"contactPersionMobile:"+contactPersionMobile);
//        Register register=new Register();
//        if(StringUtil.isEmpty(companyName)) {
//            return new RespBean("error", "公司名称不能为空!");
//        }else{
//            register.setCompanyName(companyName);
//        }
//        if(StringUtil.isEmpty(mobilePhone)) {
//            return new RespBean("error", "电话号码不能为空!");
//        }else{
//            register.setMobilePhone(mobilePhone);
//        }
//        if(StringUtil.isEmpty(password)) {
//            return new RespBean("error", "登录密码不能为空!");
//        }else{
//            register.setPassword(password);
//        }
//        if(StringUtil.isEmpty(verificationCode)) {
//            return new RespBean("error", "验证码不能为空!");
//        }else{
//            register.setVerificationCode(verificationCode);
//        }
//        register.setContactPersion(contactPersion);
//        register.setContactPersionMobile(contactPersionMobile);
//        register.setIndustryInfo(industryInfo);
//        if (manageUserService.userRegist(register)) {
//            return new RespBean("success", "添加成功!");
//        }
//        return new RespBean("error", "添加失败!");
//    }
//    @RequestMapping(value = "/industryInfo", method = RequestMethod.GET)
//    public Map<String, Object> getIndustryInfo() {
//        Map<String, Object> map = new HashMap<>();
//        map.put("industryInfo", manageUserService.getIndustryInfo());
//        return map;
//    }
//    @RequestMapping(value = "/sendVricode", method = RequestMethod.POST)
//    public RespBean SendVricode(@RequestParam String mobilePhone) {
//        logger.info("sendVricode====>mobilePhone:"+ mobilePhone);
//        return new RespBean("success", "短信发送成功!");
//    }
//}